package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.ProjectBean;
import com.project.mapper.ProjectMapper;
import com.project.service.IProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class ProjectServiceImpl implements IProjectService {
    @Autowired
    private ProjectMapper mapper;
    @Override
    public void addProject(ProjectBean project) {
        mapper.addProject(project);
    }

    @Override
    public ProjectBean findProject(int id) {
        return mapper.findProject(id);
    }

    @Override
    public PageInfo<ProjectBean> findByItem(int page, String name, String statues, String collations) {
        PageHelper.startPage(page,3);
        PageInfo info = PageInfo.of(mapper.findByItem(name, statues, collations));
        return info;
    }

    @Override
    public List<ProjectBean> findNoFinish() {
        return mapper.findByState("开发中");
    }
}
